package com.hkunderground.blogger.helper;

import java.util.ResourceBundle;

public class PropertiesHelper {
	
	private static String BLOG_FEEDURL = null;	
	private static String BLOG_USERNAME = null;
	private static String BLOG_PASSWORD = null;
	
	private static String BLOG_VIEWER_PAGE = null;
	private static String BLOG_DETAIL_PAGE = null;
	
	private static int BLOG_PAGESIZE = 0;
	private static int BLOG_PREVIEWSIZE = 0;
		
	private static  ResourceBundle mrbBlogSetting = null;
	
	public static String getBlogFeedUrl()
	{
		if (BLOG_FEEDURL != null)
		{
			return BLOG_FEEDURL;
		}//if (BLOG_URL != null)
		
		
		if (mrbBlogSetting == null)
		{
			mrbBlogSetting = ResourceBundle.getBundle(ConstantHelper.BLOGGER_RESOURCE_BUNDLE);
		}//	if (mrbBlogSetting == null)
		
		BLOG_FEEDURL =  mrbBlogSetting.getString(ConstantHelper.BLOGGER_PROP_URL);
		
		return BLOG_FEEDURL;
	}//getBlogUser

	public static String getBlogUser()
	{
		if (BLOG_USERNAME != null)
		{
			return BLOG_USERNAME;
		}//if (BLOG_URL != null)
		
		if (mrbBlogSetting == null)
		{
			mrbBlogSetting = ResourceBundle.getBundle(ConstantHelper.BLOGGER_RESOURCE_BUNDLE);
		}//	if (mrbBlogSetting == null)

		BLOG_USERNAME =  mrbBlogSetting.getString(ConstantHelper.BLOGGER_USERNAME);
		
		return BLOG_USERNAME;
	}//getBlogUser
	
	public static String getBlogPwd()
	{
		if (BLOG_PASSWORD != null)
		{
			return BLOG_PASSWORD;
		}//if (BLOG_URL != null)
		
		if (mrbBlogSetting == null)
		{
			mrbBlogSetting = ResourceBundle.getBundle(ConstantHelper.BLOGGER_RESOURCE_BUNDLE);
		}//	if (mrbBlogSetting == null)

		BLOG_PASSWORD =  mrbBlogSetting.getString(ConstantHelper.BLOGGER_PASSWORD);
		
		return BLOG_PASSWORD;
	}//getBlogUser	
	
	public static int getBlogPageSize()
	{
		if (BLOG_PAGESIZE != 0)
		{
			return BLOG_PAGESIZE;
		}//if (BLOG_URL != null)
		
		if (mrbBlogSetting == null)
		{
			mrbBlogSetting = ResourceBundle.getBundle(ConstantHelper.BLOGGER_RESOURCE_BUNDLE);
		}//	if (mrbBlogSetting == null)

		BLOG_PAGESIZE =  Integer.parseInt(mrbBlogSetting.getString(ConstantHelper.BLOGGER_PAGE_SIZE));
		
		return BLOG_PAGESIZE;
	}//getBlogPageSize	
	
	public static String getBlogViewerPage()
	{
		if (BLOG_VIEWER_PAGE != null)
		{
			return BLOG_VIEWER_PAGE;
		}//if (BLOG_URL != null)
		
		if (mrbBlogSetting == null)
		{
			mrbBlogSetting = ResourceBundle.getBundle(ConstantHelper.BLOGGER_RESOURCE_BUNDLE);
		}//	if (mrbBlogSetting == null)

		BLOG_VIEWER_PAGE =  mrbBlogSetting.getString(ConstantHelper.BLOGGER_PAGE_VIEWER);
		
		return BLOG_VIEWER_PAGE;
	}//getBlogViewerPage
	
	public static String getBlogDetailPage()
	{
		if (BLOG_DETAIL_PAGE != null)
		{
			return BLOG_DETAIL_PAGE;
		}//if (BLOG_URL != null)
		
		if (mrbBlogSetting == null)
		{
			mrbBlogSetting = ResourceBundle.getBundle(ConstantHelper.BLOGGER_RESOURCE_BUNDLE);
		}//	if (mrbBlogSetting == null)

		BLOG_DETAIL_PAGE =  mrbBlogSetting.getString(ConstantHelper.BLOGGER_PAGE_DETAIL);
		
		return BLOG_DETAIL_PAGE;
	}//getBlogDetailPage
	
	public static int getBlogPreviewSize()
	{
		if (BLOG_PREVIEWSIZE != 0)
		{
			return BLOG_PREVIEWSIZE;
		}//if (BLOG_URL != null)
		
		if (mrbBlogSetting == null)
		{
			mrbBlogSetting = ResourceBundle.getBundle(ConstantHelper.BLOGGER_RESOURCE_BUNDLE);
		}//	if (mrbBlogSetting == null)

		BLOG_PREVIEWSIZE =  Integer.parseInt(mrbBlogSetting.getString(ConstantHelper.BLOGGER_PREVIEW_SIZE));
		
		return BLOG_PREVIEWSIZE;
	}//getBlogPreviewSize	
}//PropertiesHelper